;(function($){
	
$.fn.rollGallery=function( options ){
	
	var opts=$.extend({},$.fn.rollGallery.defaults,options);
	
	return this.each(function(){
		var _this=$(this);
		var step=0;
		var maxMove=0;
		var animateArgu=new Object();
		_this.intervalRGallery=null;
		
		if( opts.noStep&&(!options.speed) ) opts.speed=30;
		
		if( opts.direction=="left"){
			step=_this.children( opts.childrenSel ).outerWidth(true);
		}else{
			step=_this.children( opts.childrenSel ).outerHeight(true);
		}
		
		maxMove=-(step*_this.children( opts.childrenSel ).length);
		_this[0].maxMove=maxMove;
		if( opts.rollNum ) step*=opts.rollNum;	
		animateArgu[ opts.direction ]="-="+step;	
				
		_this.children( opts.childrenSel ).slice( 0,opts.showNum ).clone(true).appendTo( _this );
		_this.mouseover( function(){ clearInterval( _this.intervalRGallery ); });
		_this.mouseout( function(){ _this.intervalRGallery=setInterval( function(){
				if( parseInt(_this.css( opts.direction ))<=maxMove ){
					_this.css( opts.direction , "0px");
				}
				if( opts.noStep ){
					_this.css( opts.direction, (parseInt(_this.css( opts.direction ))-opts.speedPx+"px") );
				}
				else{
					_this.animate( animateArgu ,opts.aniSpeed,opts.aniMethod );
				}
			}, opts.speed );});
		
		_this.mouseout();
	});
			
};

$.fn.rollGallery.defaults={
	direction : "left",
	speed : 3000,
	noStep : false,
	speedPx : 1,
	showNum : 1,
	aniSpeed:"slow",
	aniMethod:"swing",
	childrenSel:"*"
};
	
})(jQuery);

function scrollLeft() {
	var speed = 50;
	case_pic_btm2.innerHTML = case_pic_btm1.innerHTML;

	function scrollLeftInner() {
		if(case_pic_list_btm_id.scrollLeft >= case_pic_btm1.scrollWidth){
			case_pic_list_btm_id.scrollLeft = 0;
		} else {
			case_pic_list_btm_id.scrollLeft++;
		}
	}

	var marVal = setInterval(scrollLeftInner, speed);
	case_pic_list_btm_id.onmouseover = function() {clearInterval(marVal)}
	case_pic_list_btm_id.onmouseout = function() {marVal = setInterval(scrollLeftInner, speed)}
}

function scrollLeftDemo() {
	var speed = 50;
	case_pic_btm2.innerHTML = case_pic_btm1.innerHTML;

	var scollInner = function() {
		if(case_pic_list_btm_id.scrollLeft >= case_pic_btm1.scrollWidth){
			case_pic_list_btm_id.scrollLeft = 0;
		} else {
			case_pic_list_btm_id.scrollLeft++;
		}
	}

	var marVal = setInterval(scollInner, speed);
	case_pic_list_btm_id.onmouseover = function() {clearInterval(marVal)}
	case_pic_list_btm_id.onmouseout = function() {marVal = setInterval(scollInner, speed)}
}
